﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.Security;
using Telerik.Web.UI;
using System.ComponentModel;

namespace BSCMFF.Web.UserControls.Details
{
    public partial class PKPIDetails : System.Web.UI.UserControl
    {
        public String Name
        {
            get
            {
                return RadTextBoxName.Text;
            }
        }

        public String Description
        {
            get
            {
                return RadTextBoxDescription.Text;
            }
        }

        public String Measure
        {
            get
            {
                return RadTextBoxMeasure.Text;
            }
        }

        //public String VerbalEvaluation
        //{
        //    get
        //    {
        //        return RadTextBoxVerbalEvaluation.Text;
        //    }
        //}

        //public int Weight
        //{
        //    get
        //    {
        //        return (int)RadNumericTextBoxWeight.Value;
        //    }
        //}

        public int? StartValue
        {
            get
            {
                return (int?)RadNumericTextBoxStartValue.Value;
            }
        }

        public int? TargetValue
        {
            get
            {
                return (int?)RadNumericTextBoxTargetValue.Value;
            }
        }

        public int? CurrentValue
        {
            get
            {
                return (int?)RadNumericTextBoxCurrentValue.Value;
            }
        }

        protected void Page_Load(object sender, EventArgs e)
        {
            if (!Roles.IsUserInRole("Manager"))
            {
                //DisablePKPIProperties();
            }

            //if ((Container)this is GridEditFormInsertItem)
            //{

            //}
            //if(Container.
        }

        private void DisablePKPIProperties()
        {
            foreach (Control c in this.Controls)
            {
                if (c.GetType().Name == typeof(RadTextBox).Name)
                {
                    ((RadTextBox)c).Enabled = false;
                }
                if(c.GetType().Name == typeof(RadNumericTextBox).Name)
                {
                    ((RadNumericTextBox)c).Enabled = false;
                }
            }
        }
    }
}